<?php

namespace App\Transformers\Shipping;

use App\Models\ShippingTemplates;
use League\Fractal\TransformerAbstract;

class ShippingTemplatesInfoTransformer extends TransformerAbstract
{
    public function transform(ShippingTemplates $shippingTemplates){
        return [
            'id' => $shippingTemplates->id,
            'name' => $shippingTemplates->name ?? '',
            'appoint' => $shippingTemplates->appoint ?? '',
            'sort' => $shippingTemplates->sort ?? '',
            'type' =>$shippingTemplates->typeEnum[$shippingTemplates->type] ?? '',
            'free' =>$shippingTemplates->free ?? '',
            'region' =>$shippingTemplates->region ?? '',
            'created_at' => $shippingTemplates->created_at ? $shippingTemplates->created_at->format("Y-m-d H:i:s") : '',
            'updated_at' => $shippingTemplates->updated_at ? $shippingTemplates->updated_at->format("Y-m-d H:i:s") : '',
        ];
    }

}
